﻿//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	ServicesExts.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System.Diagnostics;
using Microsoft.SharePoint;

namespace Smart.Common
{
	public static class ServicesExts
	{
		/// <summary>
		/// Return configuration value by <paramref name="keyName"/>
		/// </summary>
		[DebuggerStepThrough]
		public static string GetConfigValue(this string keyName, string defaultValue)
		{
			return
				SPServices.Configuration.GetValue(keyName, defaultValue);
		}

		/// <summary>
		/// Set configuration value for Web by <paramref name="keyName"/>
		/// </summary>
		[DebuggerStepThrough]
		public static void SetConfigValueWeb(this string keyName, SPWeb web, string value)
		{
			SPServices.Configuration.SetValue(web, keyName, value);
		}

		/// <summary>
		/// Set configuration value for current User by <paramref name="keyName"/>
		/// </summary>
		[DebuggerStepThrough]
		public static void SetConfigValueUser(this string keyName, string value)
		{
			SPServices.Configuration.SetUserValue(keyName, value);
		}
	}
}